import { ResPage, User, newUser } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 用户管理模块
 */
// 获取用户列表
export const getUserList = (params: User.ReqUserParams) => {
  return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/list`, params);
};

// 获取树形用户列表
export const getUserTreeList = (params: User.ReqUserParams) => {
  return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/tree/list`, params);
};

// 新增用户
export const addUser = (params: { id: string }) => {
  return http.post(PORT1 + `/user/add`, params);
};

// 批量添加用户
export const BatchAddUser = (params: FormData) => {
  return http.post(PORT1 + `/user/import`, params);
};

// 编辑用户
export const editUser = (params: { id: string }) => {
  return http.post(PORT1 + `/user/edit`, params);
};

// 删除用户
export const deleteUser = (params: { id: string[] }) => {
  return http.post(PORT1 + `/user/delete`, params);
};

// 切换用户状态
export const changeUserStatus = (params: { id: string; status: number }) => {
  return http.post(PORT1 + `/user/change`, params);
};

// 重置用户密码
export const resetUserPassWord = (params: { id: string }) => {
  return http.post(PORT1 + `/user/rest_password`, params);
};

// 导出用户数据
export const exportUserInfo = (params: User.ReqUserParams) => {
  return http.download(PORT1 + `/user/export`, params);
};

// 获取用户状态字典
export const getUserStatus = () => {
  return http.get<User.ResStatus[]>(PORT1 + `/user/status`);
};

// 获取用户性别字典
export const getUserGender = () => {
  return http.get<User.ResGender[]>(PORT1 + `/user/gender`);
};

// 获取用户部门列表
export const getUserDepartment = () => {
  return http.get<User.ResDepartment[]>(PORT1 + `/user/department`, {}, { cancel: false });
};

// 获取用户角色字典
export const getUserRole = () => {
  return http.get<User.ResRole[]>(PORT1 + `/user/role`);
};

// 新版 S
// 人员管理
export const getNewUserTreeList = (params: newUser.ReqNewUserParams) => {
  return http.post<ResPage<newUser.ResNewUserList>>(`/sysUser/getUserPageList`, params);
};
export const getNewAddUserTree = params => {
  return http.post(`/sysUser/add`, params);
};
export const getNewEditUserTreeList = params => {
  return http.post(`/sysUser/edit`, params);
};
export const getNewDelUserTreeList = params => {
  return http.delete(`/sysUser/remove`, params);
};

// 角色管理
export const getNewSysRoleTreeList = () => {
  return http.get(`/sysRole/list`);
};
export const getNewRoleTreeList = params => {
  return http.post(`/sysRole/getRolePageList`, params);
};
export const getNewAddRole = params => {
  return http.post(`/sysRole/add`, params);
};
export const getNewEditRole = params => {
  return http.post(`/sysRole/edit`, params);
};
export const getNewDelRole = params => {
  return http.delete(`/sysRole/remove`, params);
};

// 部门管理
export const getNewSysDepartmentTreeList = params => {
  return http.post(`/sysDepartment/getDepartmentPageList`, params);
};
export const getNewAddDepartment = params => {
  return http.post(`/sysDepartment/add`, params);
};
export const getNewEditDepartment = params => {
  return http.post(`/sysDepartment/edit`, params);
};
export const getNewDelDepartment = params => {
  return http.delete(`/sysDepartment/remove`, params);
};

// 项目管理
export const getNewSysProjectTreeList = params => {
  return http.post(`/syProject/getByPage`, params);
};
export const getNewAddProject = params => {
  return http.post(`/syProject/add`, params);
};
export const getNewDistrictList = () => {
  return http.get(`/syDistrict/getDistrictTree`);
};
export const getNewEditProject = params => {
  return http.post(`/syProject/edit`, params);
};
export const getNewDelProject = params => {
  return http.delete(`/syProject/remove`, params);
};

// 直播管理
export const getNewSysLiveDataTreeList = params => {
  return http.post(`/syLiveData/getLiveDataPageList`, params);
};
export const getNewAddLiveData = params => {
  return http.post(`/syLiveData/add`, params);
};
export const getNewEditLiveData = params => {
  return http.post(`/syLiveData/edit`, params);
};
export const getNewDelLiveData = params => {
  return http.delete(`/syLiveData/remove`, params);
};

// 短视频管理
export const getNewSysVideoTreeList = params => {
  return http.post(`/syShortVideo/getShortVideoPageList`, params);
};
export const getNewAddVideo = params => {
  return http.post(`/syShortVideo/add`, params);
};
export const getNewEditVideo = params => {
  return http.post(`/syShortVideo/edit`, params);
};
export const getNewDelVideo = params => {
  return http.delete(`/syShortVideo/remove`, params);
};

// 设备管理
export const getNewSysDeviceTreeList = params => {
  return http.post(`/syDevice/getByPage`, params);
};
export const getNewAddDevice = params => {
  return http.post(`/syDevice/add`, params);
};
export const getNewEditDevice = params => {
  return http.post(`/syDevice/edit`, params);
};
export const getNewDelDevice = params => {
  return http.delete(`/syDevice/remove`, params);
};

// 新版 E
